NACHOS12.L75-MAA11

creation : 28/07/2017

purpose : same as NACHOS12.L75-MAA10 with different time-steps

outcome : time_step at 360 for one year (2010), then 480 for the rest of the simulations (2011-2012)

First year of simulations 2010

In [2]:
import numpy as np
import numpy.ma as ma
import xarray as xr
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature


%matplotlib inline

# Paramètres

case='MAA11'
year='2010'

dirmean='/home/users/albert6a/Data/NACHOS12.L75/NACHOS12.L75-'+case+'-MEAN/'
dirplot='/home/users/albert6a/Data/NACHOS12.L75/NACHOS12.L75-'+case+'-PLOTS/'

title="NACHOS12.L75-"+case+" "+year

# Les données

fileflxT=dirmean+'NACHOS12.L75-'+case+'_y'+year+'.1d_flxT.nc'
fileT=dirmean+'NACHOS12.L75-'+case+'_y'+year+'.1d_gridT.nc'
fileEKE=dirmean+'NACHOS12.L75-'+case+'_y'+year+'.1d_EKE.nc'
fileMXL03=dirmean+'NACHOS12.L75-'+case+'_y'+year+'m03.1d_MXL.nc'
fileMXL09=dirmean+'NACHOS12.L75-'+case+'_y'+year+'m09.1d_MXL.nc'
fileICE03=dirmean+'NACHOS12.L75-'+case+'_y'+year+'m03.1d_icemod3.nc'
fileICE09=dirmean+'NACHOS12.L75-'+case+'_y'+year+'m09.1d_icemod3.nc'
filePSI=dirmean+'NACHOS12.L75-'+case+'_y'+year+'.1d_PSI.nc'

dsT=xr.open_dataset(fileT)
tem=dsT.votemper[0]
sal=dsT.vosaline[0]
ssh=dsT.sossheig[0]
lat=dsT.nav_lat
lon=dsT.nav_lon

dsMXL03=xr.open_dataset(fileMXL03)
mxl03_rho010=dsMXL03.somxl010[0]
mxl03_rho030=dsMXL03.somxl030[0]
mxl03_t02=dsMXL03.somxlt02[0]
dsMXL09=xr.open_dataset(fileMXL09)
mxl09_rho010=dsMXL09.somxl010[0]
mxl09_rho030=dsMXL09.somxl030[0]
mxl09_t02=dsMXL09.somxlt02[0]

dsEKE=xr.open_dataset(fileEKE)
eke=dsEKE.voeke[0,0]

dsPSI=xr.open_dataset(filePSI)
psi=dsPSI.sobarstf[0]

dsflxT=xr.open_dataset(fileflxT)
Heat=dsflxT.sohefldo[0]
WaterFlx=dsflxT.sowaflup[0]
WaterDmp=dsflxT.sowafld[0]

dsICE03=xr.open_dataset(fileICE03)
iconc03=dsICE03.siconc[0]
ivolu03=dsICE03.sivolu[0]
dsICE09=xr.open_dataset(fileICE09)
iconc09=dsICE09.siconc[0]
ivolu09=dsICE09.sivolu[0]

# Les différents types de plots

def plot_glob(fig,sub,var,vmin,vmax,unit,name):
    ax = fig.add_subplot(sub,projection=ccrs.Orthographic(central_longitude=-30,
                                                    central_latitude=35))
    cmap = plt.cm.jet
    cmap.set_under(color='grey')
    pcolor=ax.pcolormesh(lon,lat,ma.masked_invalid(var),transform=ccrs.PlateCarree(),cmap=cmap,vmin=vmin,vmax=vmax)
    ax.set_global()
    ax.add_feature(cfeature.LAND,facecolor='grey')
    ax.coastlines()
    cbar=plt.colorbar(pcolor,orientation='vertical',fraction=0.026,pad=0.1)
    cbar.ax.tick_params(labelsize=20)
    ax.set_title(name+' '+unit,size=17)

def plot_atl(fig,sub,var,vmin,vmax,unit,name):
    ax = fig.add_subplot(sub,projection=ccrs.PlateCarree(central_longitude=-30))
    ax.set_extent([-100, 50, 0, 70])
    cmap = plt.cm.jet
    cmap.set_under(color='grey')
    pcolor=ax.pcolormesh(lon,lat,ma.masked_invalid(var),transform=ccrs.PlateCarree(),cmap=cmap,vmin=vmin,vmax=vmax)
    ax.add_feature(cfeature.LAND,facecolor='grey')
    ax.coastlines()
    ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
                  linewidth=2, color='gray', alpha=0.5, linestyle='--')

    fig.subplots_adjust(right=0.8)
    ax.text(-0.07, 0.55, 'Latitude (in degree)', va='bottom', ha='center',
        rotation='vertical', rotation_mode='anchor',
        transform=ax.transAxes)
    ax.text(0.5, -0.1, 'Longitude (in degree)', va='bottom', ha='center',
        rotation='horizontal', rotation_mode='anchor',
        transform=ax.transAxes)
    cbar = plt.colorbar(pcolor,orientation='horizontal',shrink=0.75)
    ax.set_title(name+' '+unit,size=17,y=1.08)
    
def plot_atl_cont(fig,sub,var,unit,name,vmin,vmax):
    ax = fig.add_subplot(sub,projection=ccrs.PlateCarree(central_longitude=-30))
    ax.set_extent([-100, 50, 0, 70])
    cmap = plt.cm.jet
    cmap.set_under(color='grey')
    pcolor=ax.pcolormesh(lon,lat,ma.masked_invalid(var),transform=ccrs.PlateCarree(),cmap=plt.cm.Blues,vmin=vmin,vmax=vmax)
    pcont=ax.contour(lon,lat,ma.masked_invalid(var),10,colors='k',transform=ccrs.PlateCarree())
    ax.add_feature(cfeature.LAND,facecolor='black')
    ax.coastlines()
    ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
                  linewidth=2, color='grey', alpha=0.5, linestyle='--')

    fig.subplots_adjust(right=0.8)
    ax.text(-0.07, 0.55, 'Latitude (in degree)', va='bottom', ha='center',
        rotation='vertical', rotation_mode='anchor',
        transform=ax.transAxes)
    ax.text(0.5, -0.1, 'Longitude (in degree)', va='bottom', ha='center',
        rotation='horizontal', rotation_mode='anchor',
        transform=ax.transAxes)
    cbar = plt.colorbar(pcolor,orientation='horizontal',shrink=0.75)
    
    ax.set_title(name+' '+unit,size=17,y=1.08)
    
def plot_natl(fig,sub,var,vmin,vmax,unit,name):
    ax = fig.add_subplot(sub,projection=ccrs.PlateCarree(central_longitude=-30))
    ax.set_extent([-100, 50, 50, 70])
    cmap = plt.cm.jet
    cmap.set_under(color='grey')
    pcolor=ax.pcolormesh(lon,lat,ma.masked_invalid(var),transform=ccrs.PlateCarree(),cmap=cmap,vmin=vmin,vmax=vmax)
    ax.add_feature(cfeature.LAND,facecolor='grey')
    ax.coastlines()
    ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
                  linewidth=2, color='gray', alpha=0.5, linestyle='--')

    fig.subplots_adjust(right=0.8)
    ax.text(-0.07, 0.55, 'Latitude (in degree)', va='bottom', ha='center',
        rotation='vertical', rotation_mode='anchor',
        transform=ax.transAxes)
    ax.text(0.5, -0.1, 'Longitude (in degree)', va='bottom', ha='center',
        rotation='horizontal', rotation_mode='anchor',
        transform=ax.transAxes)
    cbar = plt.colorbar(pcolor,orientation='horizontal',shrink=0.75)
    ax.set_title(name+' '+unit,size=17,y=1.09)
    
# Tous les plots

# Tous les plots glob

# Eke, SSH,T et S
fig = plt.figure(figsize=(15,15))
plot_glob(fig,221,10000*eke,0,2500,'1e4m2s','Surf EKE')
plot_glob(fig,222,ssh,-2,2,'m','SSH')
plot_glob(fig,223,tem[0],-2,30,'deg C','Surf Temperature')
plot_glob(fig,224,sal[0],30,40,'PSU','Surf Salinity')
fig.suptitle('NACHOS12.L75-'+case+' '+year, fontsize=25)
plt.savefig(dirplot+'glob_eke0-ssh-t0-s0_'+year+'.png')

#MXL
fig = plt.figure(figsize=(30,20))
plot_glob(fig,231,mxl03_rho010,0,1500,'m','March MXL rho010')
plot_glob(fig,234,mxl09_rho010,0,500,'m','Sept MXL rho010')
plot_glob(fig,232,mxl03_rho030,0,1500,'m','March MXL rho030')
plot_glob(fig,235,mxl09_rho030,0,500,'m','Sept MXL rho030')
plot_glob(fig,233,mxl03_t02,0,1500,'m','March MXL t02')
plot_glob(fig,236,mxl09_t02,0,500,'m','Sept MXL t02')
fig.suptitle('NACHOS12.L75-'+case+' '+year, fontsize=25)
plt.savefig(dirplot+'glob_mxl_'+year+'.png')

#flx
fig = plt.figure(figsize=(30,7))
plot_glob(fig,131,Heat,-400,400,'','Net Heat Flux')
plot_glob(fig,132,86400*WaterFlx,-7,7,'','Water Flux')
plot_glob(fig,133,86400*WaterDmp,-7,7,'','Water Damping')
fig.suptitle('NACHOS12.L75-'+case+' '+year, fontsize=25)
plt.savefig(dirplot+'glob_flxt_'+year+'.png')

#ice
fig = plt.figure(figsize=(15,15))
plot_glob(fig,221,iconc03,0,1,'%','March Ice concentration')
plot_glob(fig,222,ivolu03,0,4,'m','March Ice Volume')
plot_glob(fig,223,iconc09,0,1,'%','Sept Ice concentration')
plot_glob(fig,224,ivolu09,0,4,'m','Sept Ice Volume')
fig.suptitle('NACHOS12.L75-'+case+' '+year, fontsize=25)
plt.savefig(dirplot+'glob_ice_'+year+'.png')

# Tous les plots Atlantique

# T & S
fig = plt.figure(figsize=(30,15))
plot_atl(fig,231,tem[0],-2,30,'deg C','Surf Temperature')
plot_atl(fig,234,sal[0],30,40,'PSU','Surf Salinity')
plot_atl(fig,232,tem[30],-2,30,'deg C','200m Temperature')
plot_atl(fig,235,sal[30],30,40,'PSU','200m Salinity')
plot_atl(fig,233,tem[46],-2,30,'deg C','1000m Temperature')
plot_atl(fig,236,sal[46],30,40,'PSU','1000m Salinity')
fig.suptitle('NACHOS12.L75-'+case+' '+year, fontsize=25)
plt.savefig(dirplot+'atl_t-s-0-200-1000_'+year+'.png')

#PSI
fig = plt.figure(figsize=(10,7))
plot_atl_cont(fig,111,1e-7*psi,'','Stream function',-4,4)
fig.suptitle('NACHOS12.L75-'+case+' '+year, fontsize=25)
plt.savefig(dirplot+'atl_psi_'+year+'.png')

#flx
fig = plt.figure(figsize=(30,7))
plot_atl(fig,131,Heat,-400,400,'','Net Heat Flux')
plot_atl(fig,132,86400*WaterFlx,-7,7,'','Water Flux')
plot_atl(fig,133,86400*WaterDmp,-7,7,'','Water Damping')
fig.suptitle('NACHOS12.L75-'+case+' '+year, fontsize=25)
plt.savefig(dirplot+'atl_flxt_'+year+'.png')

#Tous les plots N Attlantique

fig = plt.figure(figsize=(30,15))
plot_natl(fig,221,iconc03,0,1,'%','March Ice concentration')
plot_natl(fig,222,ivolu03,0,4,'m','March Ice Volume')
plot_natl(fig,223,iconc09,0,1,'%','Sept Ice concentration')
plot_natl(fig,224,ivolu09,0,4,'m','Sept Ice Volume')
fig.suptitle('NACHOS12.L75-'+case+' '+year, fontsize=25)
plt.savefig(dirplot+'natl_ice_'+year+'.png')
/home/users/albert6a/anaconda2/lib/python2.7/site-packages/xarray/core/formatting.py:16: FutureWarning: The pandas.tslib module is deprecated and will be removed in a future version.
  from pandas.tslib import OutOfBoundsDatetime
In [3]:
# Paramètres

case='MAA11'
year='2011'

dirmean='/home/users/albert6a/Data/NACHOS12.L75/NACHOS12.L75-'+case+'-MEAN/'
dirplot='/home/users/albert6a/Data/NACHOS12.L75/NACHOS12.L75-'+case+'-PLOTS/'

title="NACHOS12.L75-"+case+" "+year

# Les données

fileflxT=dirmean+'NACHOS12.L75-'+case+'_y'+year+'.1d_flxT.nc'
fileT=dirmean+'NACHOS12.L75-'+case+'_y'+year+'.1d_gridT.nc'
fileEKE=dirmean+'NACHOS12.L75-'+case+'_y'+year+'.1d_EKE.nc'
fileMXL03=dirmean+'NACHOS12.L75-'+case+'_y'+year+'m03.1d_MXL.nc'
fileMXL09=dirmean+'NACHOS12.L75-'+case+'_y'+year+'m09.1d_MXL.nc'
fileICE03=dirmean+'NACHOS12.L75-'+case+'_y'+year+'m03.1d_icemod3.nc'
fileICE09=dirmean+'NACHOS12.L75-'+case+'_y'+year+'m09.1d_icemod3.nc'
filePSI=dirmean+'NACHOS12.L75-'+case+'_y'+year+'.1d_PSI.nc'

dsT=xr.open_dataset(fileT)
tem=dsT.votemper[0]
sal=dsT.vosaline[0]
ssh=dsT.sossheig[0]
lat=dsT.nav_lat
lon=dsT.nav_lon

dsMXL03=xr.open_dataset(fileMXL03)
mxl03_rho010=dsMXL03.somxl010[0]
mxl03_rho030=dsMXL03.somxl030[0]
mxl03_t02=dsMXL03.somxlt02[0]
dsMXL09=xr.open_dataset(fileMXL09)
mxl09_rho010=dsMXL09.somxl010[0]
mxl09_rho030=dsMXL09.somxl030[0]
mxl09_t02=dsMXL09.somxlt02[0]

dsEKE=xr.open_dataset(fileEKE)
eke=dsEKE.voeke[0,0]

dsPSI=xr.open_dataset(filePSI)
psi=dsPSI.sobarstf[0]

dsflxT=xr.open_dataset(fileflxT)
Heat=dsflxT.sohefldo[0]
WaterFlx=dsflxT.sowaflup[0]
WaterDmp=dsflxT.sowafld[0]

dsICE03=xr.open_dataset(fileICE03)
iconc03=dsICE03.siconc[0]
ivolu03=dsICE03.sivolu[0]
dsICE09=xr.open_dataset(fileICE09)
iconc09=dsICE09.siconc[0]
ivolu09=dsICE09.sivolu[0]

# Les différents types de plots

def plot_glob(fig,sub,var,vmin,vmax,unit,name):
    ax = fig.add_subplot(sub,projection=ccrs.Orthographic(central_longitude=-30,
                                                    central_latitude=35))
    cmap = plt.cm.jet
    cmap.set_under(color='grey')
    pcolor=ax.pcolormesh(lon,lat,ma.masked_invalid(var),transform=ccrs.PlateCarree(),cmap=cmap,vmin=vmin,vmax=vmax)
    ax.set_global()
    ax.add_feature(cfeature.LAND,facecolor='grey')
    ax.coastlines()
    cbar=plt.colorbar(pcolor,orientation='vertical',fraction=0.026,pad=0.1)
    cbar.ax.tick_params(labelsize=20)
    ax.set_title(name+' '+unit,size=17)

def plot_atl(fig,sub,var,vmin,vmax,unit,name):
    ax = fig.add_subplot(sub,projection=ccrs.PlateCarree(central_longitude=-30))
    ax.set_extent([-100, 50, 0, 70])
    cmap = plt.cm.jet
    cmap.set_under(color='grey')
    pcolor=ax.pcolormesh(lon,lat,ma.masked_invalid(var),transform=ccrs.PlateCarree(),cmap=cmap,vmin=vmin,vmax=vmax)
    ax.add_feature(cfeature.LAND,facecolor='grey')
    ax.coastlines()
    ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
                  linewidth=2, color='gray', alpha=0.5, linestyle='--')

    fig.subplots_adjust(right=0.8)
    ax.text(-0.07, 0.55, 'Latitude (in degree)', va='bottom', ha='center',
        rotation='vertical', rotation_mode='anchor',
        transform=ax.transAxes)
    ax.text(0.5, -0.1, 'Longitude (in degree)', va='bottom', ha='center',
        rotation='horizontal', rotation_mode='anchor',
        transform=ax.transAxes)
    cbar = plt.colorbar(pcolor,orientation='horizontal',shrink=0.75)
    ax.set_title(name+' '+unit,size=17,y=1.08)
    
def plot_atl_cont(fig,sub,var,unit,name,vmin,vmax):
    ax = fig.add_subplot(sub,projection=ccrs.PlateCarree(central_longitude=-30))
    ax.set_extent([-100, 50, 0, 70])
    cmap = plt.cm.jet
    cmap.set_under(color='grey')
    pcolor=ax.pcolormesh(lon,lat,ma.masked_invalid(var),transform=ccrs.PlateCarree(),cmap=plt.cm.Blues,vmin=vmin,vmax=vmax)
    pcont=ax.contour(lon,lat,ma.masked_invalid(var),10,colors='k',transform=ccrs.PlateCarree())
    ax.add_feature(cfeature.LAND,facecolor='black')
    ax.coastlines()
    ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
                  linewidth=2, color='grey', alpha=0.5, linestyle='--')

    fig.subplots_adjust(right=0.8)
    ax.text(-0.07, 0.55, 'Latitude (in degree)', va='bottom', ha='center',
        rotation='vertical', rotation_mode='anchor',
        transform=ax.transAxes)
    ax.text(0.5, -0.1, 'Longitude (in degree)', va='bottom', ha='center',
        rotation='horizontal', rotation_mode='anchor',
        transform=ax.transAxes)
    cbar = plt.colorbar(pcolor,orientation='horizontal',shrink=0.75)
    
    ax.set_title(name+' '+unit,size=17,y=1.08)
    
def plot_natl(fig,sub,var,vmin,vmax,unit,name):
    ax = fig.add_subplot(sub,projection=ccrs.PlateCarree(central_longitude=-30))
    ax.set_extent([-100, 50, 50, 70])
    cmap = plt.cm.jet
    cmap.set_under(color='grey')
    pcolor=ax.pcolormesh(lon,lat,ma.masked_invalid(var),transform=ccrs.PlateCarree(),cmap=cmap,vmin=vmin,vmax=vmax)
    ax.add_feature(cfeature.LAND,facecolor='grey')
    ax.coastlines()
    ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
                  linewidth=2, color='gray', alpha=0.5, linestyle='--')

    fig.subplots_adjust(right=0.8)
    ax.text(-0.07, 0.55, 'Latitude (in degree)', va='bottom', ha='center',
        rotation='vertical', rotation_mode='anchor',
        transform=ax.transAxes)
    ax.text(0.5, -0.1, 'Longitude (in degree)', va='bottom', ha='center',
        rotation='horizontal', rotation_mode='anchor',
        transform=ax.transAxes)
    cbar = plt.colorbar(pcolor,orientation='horizontal',shrink=0.75)
    ax.set_title(name+' '+unit,size=17,y=1.09)
    
# Tous les plots

# Tous les plots glob

# Eke, SSH,T et S
fig = plt.figure(figsize=(15,15))
plot_glob(fig,221,10000*eke,0,2500,'1e4m2s','Surf EKE')
plot_glob(fig,222,ssh,-2,2,'m','SSH')
plot_glob(fig,223,tem[0],-2,30,'deg C','Surf Temperature')
plot_glob(fig,224,sal[0],30,40,'PSU','Surf Salinity')
fig.suptitle('NACHOS12.L75-'+case+' '+year, fontsize=25)
plt.savefig(dirplot+'glob_eke0-ssh-t0-s0_'+year+'.png')

#MXL
fig = plt.figure(figsize=(30,20))
plot_glob(fig,231,mxl03_rho010,0,1500,'m','March MXL rho010')
plot_glob(fig,234,mxl09_rho010,0,500,'m','Sept MXL rho010')
plot_glob(fig,232,mxl03_rho030,0,1500,'m','March MXL rho030')
plot_glob(fig,235,mxl09_rho030,0,500,'m','Sept MXL rho030')
plot_glob(fig,233,mxl03_t02,0,1500,'m','March MXL t02')
plot_glob(fig,236,mxl09_t02,0,500,'m','Sept MXL t02')
fig.suptitle('NACHOS12.L75-'+case+' '+year, fontsize=25)
plt.savefig(dirplot+'glob_mxl_'+year+'.png')

#flx
fig = plt.figure(figsize=(30,7))
plot_glob(fig,131,Heat,-400,400,'','Net Heat Flux')
plot_glob(fig,132,86400*WaterFlx,-7,7,'','Water Flux')
plot_glob(fig,133,86400*WaterDmp,-7,7,'','Water Damping')
fig.suptitle('NACHOS12.L75-'+case+' '+year, fontsize=25)
plt.savefig(dirplot+'glob_flxt_'+year+'.png')

#ice
fig = plt.figure(figsize=(15,15))
plot_glob(fig,221,iconc03,0,1,'%','March Ice concentration')
plot_glob(fig,222,ivolu03,0,4,'m','March Ice Volume')
plot_glob(fig,223,iconc09,0,1,'%','Sept Ice concentration')
plot_glob(fig,224,ivolu09,0,4,'m','Sept Ice Volume')
fig.suptitle('NACHOS12.L75-'+case+' '+year, fontsize=25)
plt.savefig(dirplot+'glob_ice_'+year+'.png')

# Tous les plots Atlantique

# T & S
fig = plt.figure(figsize=(30,15))
plot_atl(fig,231,tem[0],-2,30,'deg C','Surf Temperature')
plot_atl(fig,234,sal[0],30,40,'PSU','Surf Salinity')
plot_atl(fig,232,tem[30],-2,30,'deg C','200m Temperature')
plot_atl(fig,235,sal[30],30,40,'PSU','200m Salinity')
plot_atl(fig,233,tem[46],-2,30,'deg C','1000m Temperature')
plot_atl(fig,236,sal[46],30,40,'PSU','1000m Salinity')
fig.suptitle('NACHOS12.L75-'+case+' '+year, fontsize=25)
plt.savefig(dirplot+'atl_t-s-0-200-1000_'+year+'.png')

#PSI
fig = plt.figure(figsize=(10,7))
plot_atl_cont(fig,111,1e-7*psi,'','Stream function',-4,4)
fig.suptitle('NACHOS12.L75-'+case+' '+year, fontsize=25)
plt.savefig(dirplot+'atl_psi_'+year+'.png')

#flx
fig = plt.figure(figsize=(30,7))
plot_atl(fig,131,Heat,-400,400,'','Net Heat Flux')
plot_atl(fig,132,86400*WaterFlx,-7,7,'','Water Flux')
plot_atl(fig,133,86400*WaterDmp,-7,7,'','Water Damping')
fig.suptitle('NACHOS12.L75-'+case+' '+year, fontsize=25)
plt.savefig(dirplot+'atl_flxt_'+year+'.png')

#Tous les plots N Attlantique

fig = plt.figure(figsize=(30,15))
plot_natl(fig,221,iconc03,0,1,'%','March Ice concentration')
plot_natl(fig,222,ivolu03,0,4,'m','March Ice Volume')
plot_natl(fig,223,iconc09,0,1,'%','Sept Ice concentration')
plot_natl(fig,224,ivolu09,0,4,'m','Sept Ice Volume')
fig.suptitle('NACHOS12.L75-'+case+' '+year, fontsize=25)
plt.savefig(dirplot+'natl_ice_'+year+'.png')
/home/users/albert6a/anaconda2/lib/python2.7/site-packages/matplotlib/contour.py:1514: UserWarning: Warning: converting a masked element to nan.
  self.zmax = float(z.max())
/home/users/albert6a/anaconda2/lib/python2.7/site-packages/matplotlib/contour.py:1515: UserWarning: Warning: converting a masked element to nan.
  self.zmin = float(z.min())
/home/users/albert6a/anaconda2/lib/python2.7/site-packages/matplotlib/contour.py:1153: RuntimeWarning: invalid value encountered in greater
  return lev[(lev > zmin) & (lev < zmax)]
/home/users/albert6a/anaconda2/lib/python2.7/site-packages/matplotlib/contour.py:1153: RuntimeWarning: invalid value encountered in less
  return lev[(lev > zmin) & (lev < zmax)]
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-3-20f6b1f6aee9> in <module>()
    190 #PSI
    191 fig = plt.figure(figsize=(10,7))
--> 192 plot_atl_cont(fig,111,1e-7*psi,'','Stream function',-4,4)
    193 fig.suptitle('NACHOS12.L75-'+case+' '+year, fontsize=25)
    194 plt.savefig(dirplot+'atl_psi_'+year+'.png')

<ipython-input-3-20f6b1f6aee9> in plot_atl_cont(fig, sub, var, unit, name, vmin, vmax)
     96     cmap.set_under(color='grey')
     97     pcolor=ax.pcolormesh(lon,lat,ma.masked_invalid(var),transform=ccrs.PlateCarree(),cmap=plt.cm.Blues,vmin=vmin,vmax=vmax)
---> 98     pcont=ax.contour(lon,lat,ma.masked_invalid(var),10,colors='k',transform=ccrs.PlateCarree())
     99     ax.add_feature(cfeature.LAND,facecolor='black')
    100     ax.coastlines()

/home/users/albert6a/anaconda2/lib/python2.7/site-packages/cartopy/mpl/geoaxes.pyc in contour(self, *args, **kwargs)
   1298         else:
   1299             kwargs['transform'] = t
-> 1300         result = matplotlib.axes.Axes.contour(self, *args, **kwargs)
   1301 
   1302         self.autoscale_view()

/home/users/albert6a/anaconda2/lib/python2.7/site-packages/matplotlib/__init__.pyc in inner(ax, *args, **kwargs)
   1896                     warnings.warn(msg % (label_namer, func.__name__),
   1897                                   RuntimeWarning, stacklevel=2)
-> 1898             return func(ax, *args, **kwargs)
   1899         pre_doc = inner.__doc__
   1900         if pre_doc is None:

/home/users/albert6a/anaconda2/lib/python2.7/site-packages/matplotlib/axes/_axes.pyc in contour(self, *args, **kwargs)
   5823             self.cla()
   5824         kwargs['filled'] = False
-> 5825         contours = mcontour.QuadContourSet(self, *args, **kwargs)
   5826         self.autoscale_view()
   5827         return contours

/home/users/albert6a/anaconda2/lib/python2.7/site-packages/matplotlib/contour.pyc in __init__(self, ax, *args, **kwargs)
    863 
    864         self._process_args(*args, **kwargs)
--> 865         self._process_levels()
    866 
    867         if self.colors is not None:

/home/users/albert6a/anaconda2/lib/python2.7/site-packages/matplotlib/contour.pyc in _process_levels(self)
   1197         # The following attributes are no longer needed, and
   1198         # should be deprecated and removed to reduce confusion.
-> 1199         self.vmin = np.amin(self.levels)
   1200         self.vmax = np.amax(self.levels)
   1201 

/home/users/albert6a/anaconda2/lib/python2.7/site-packages/numpy/core/fromnumeric.pyc in amin(a, axis, out, keepdims)
   2350 
   2351     return _methods._amin(a, axis=axis,
-> 2352                           out=out, **kwargs)
   2353 
   2354 

/home/users/albert6a/anaconda2/lib/python2.7/site-packages/numpy/core/_methods.pyc in _amin(a, axis, out, keepdims)
     27 
     28 def _amin(a, axis=None, out=None, keepdims=False):
---> 29     return umr_minimum(a, axis, None, out, keepdims)
     30 
     31 def _sum(a, axis=None, dtype=None, out=None, keepdims=False):

ValueError: zero-size array to reduction operation minimum which has no identity
In [ ]: